<?php
/**
 * 单例-基类
*/

namespace houze;


trait SingleCase
{
    private static $instance = null;
    private function __construct(){}
    private function __clone(){}

    /**
     * 实例化对象方法，供外部获得唯一的对象
    */
    public static function run(...$params){
        if (empty(self::$instance)) {
            self::$instance = new static(...$params);
        }

        return self::$instance;
    }
}